//
//  CantonesCreator.m
//  Futbol5Final
//
//  Created by Johan Chaves on 4/13/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "CantonesCreator.h"
#import "CantonVO.h"

@implementation CantonesCreator

-(NSMutableArray *) createCantones:(ProvinciaVO*)pprovincia: (NSDictionary *)cantonesData{
    
    NSMutableArray * cantonesResult = [[NSMutableArray alloc]init];
    
    CantonVO *cantonVoTmp;
    
    NSMutableDictionary *cantonTmp = [[NSMutableDictionary alloc]init];
    
    NSString *ids;
    
    NSEnumerator *arrenum = [cantonesData objectEnumerator];
    id cobj;   
    
    while ( cobj = [arrenum nextObject] ) {
        
        [cantonTmp setDictionary:cobj];
        ids = [cantonTmp objectForKey:@"id_canton"];
        
        cantonVoTmp = [[CantonVO alloc]initWithData: pprovincia:[cantonTmp objectForKey:@"distritos"]:[cantonTmp objectForKey:@"nombre"] :UITableViewCellStyleDefault :[ids intValue] reuseIdentifier:@"canton"];            
        
        [cantonesResult addObject:cantonVoTmp];
        
        [cantonVoTmp release];
        [ids release];
        
    }
    
    [cantonTmp release];
    [cobj release];
    
    return cantonesResult;
    
}

@end
